import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import toast from 'components/common/toast'
import FastClick  from 'fastclick'
import VueLazyload from 'vue-lazyload'

// 自己定义的toast插件
Vue.use(toast)

// 图片懒加载
Vue.use(VueLazyload, {
  loading: require('assets/img/15.jpg'),
})

// 解决移动端300毫秒延迟
FastClick.attach(document.body)

// 在组件上添加$bus事件，事件总线，用于多个组件之间事件发布监听
Vue.prototype.$bus = new Vue();

Vue.config.productionTip = false;
Vue.config.devtools = true

new Vue({
  router,
  store,
  render: h => h(App),
  mounted(){
    document.dispatchEvent(new Event('custom-render-trigger'))  // 预渲染
  }
}).$mount('#app')

// document.addEventListener('DOMContentLoaded', function () {
//   root.$mount('#app')
// })
